// 正方形
.-square-box(@size) {
  width: @size;
  height: @size;
}

// 高与行高一致，竖向居中
.-text-height(@h) {
  height: @h;
  line-height: @h;
}

// 竖向线性渐变
.-linear-y(@start-color, @end-color, @start-percent: 0%, @end-percent: 100%) {
  background-image: -webkit-gradient(
    linear,
    @start-percent top,
    @end-percent bottom,
    from(@start-color),
    to(@end-color)
  ); // Safari 4+, Chrome 2+
  background-image: -webkit-linear-gradient(
    top,
    color-stop(@start-color @start-percent),
    color-stop(@end-color @end-percent)
  ); // Safari 5.1+, Chrome 10+
  background-image: -moz-linear-gradient(
    top,
    @start-color @start-percent,
    @end-color @end-percent
  ); // FF 3.6+
  background-image: linear-gradient(
    to bottom,
    @start-color @start-percent,
    @end-color @end-percent
  ); // Standard, IE10
  background-repeat: no-repeat;
}

// 水平线性渐变
.-linear-x(@start-color, @end-color, @start-percent: 0%, @end-percent: 100%) {
  background-image: -webkit-gradient(
    linear,
    @start-percent left,
    @end-percent bottom,
    from(@start-color),
    to(@end-color)
  ); // Safari 4+, Chrome 2+
  background-image: -webkit-linear-gradient(
    left,
    color-stop(@start-color @start-percent),
    color-stop(@end-color @end-percent)
  ); // Safari 5.1+, Chrome 10+
  background-image: -moz-linear-gradient(
    left,
    @start-color @start-percent,
    @end-color @end-percent
  ); // FF 3.6+
  background-image: linear-gradient(
    to right,
    @start-color @start-percent,
    @end-color @end-percent
  ); // Standard, IE10
  background-repeat: no-repeat;
}

// flex布局
.-flex-layout(@direction: row, @align:center, @justify:center) {
  display: flex;
  justify-content: @justify;
  align-items: @align;
  flex-direction: @direction;
}

// 横向滚动盒子,靠左对齐    flex-layout 如上
.-horizontal-scroll(@width:100%) {
  .-flex-layout(row, center, flex-start);
  overflow: scroll;
  overflow-y: hidden;
  width: @width;
}

// 竖向滚动盒子,靠左对齐   flex-layout 如上
.-vertical-scroll(@height:100%) {
  .-flex-layout(column, center, flex-start);
  overflow: scroll;
  overflow-x: hidden;
  height: @height;
}

// 清除浮动
.-clearfix() {
  *zoom: 1;
  &:before,
  &:after {
    display: table;
    content: "";
    // http://nicolasgallagher.com/micro-clearfix-hack/#comment-36952
    line-height: 0;
  }
  &:after {
    clear: both;
  }
}

// 单行超出范围 ...
.-text-ellipsis() {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
   word-break: break-all; // 兼容字母和英文
}

// 多行省略超出范围
.-text-ellipsis-more(@lineNum: 2) {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: @lineNum;
  -webkit-box-orient: vertical;
   word-break: break-all; // 兼容字母和英文
}

// 骨架屏动画
.-skeleton-loading-animation() {
  background-image: linear-gradient(
    90deg,
    #eee,
    #eee 52%,
    #f1f1f1 55%,
    #f1f1f1 58%,
    #f1f1f1
  );
  background-size: 400% 100%;
  background-position: 100% 50%;
  animation: skeletonLoading 2s ease infinite; // 骨架屏动效如下
}

// 骨架屏动效
@keyframes skeletonLoading {
  0% {
    background-position: 100% 50%;
  }
  to {
    background-position: 0% 50%;
  }
}

// 0.5像素边框，默认形状为实线

.-thin-border() {
  position: relative;
  z-index: 1;
  &:before {
    content: "";
    position: absolute;
    z-index: 1;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    border: 0 solid #eaeaea;
    top: 0;
    left: 0;
    -webkit-transform-origin: left top;
    transform-origin: left top;
    width: 200%;
    height: 200%;
    -webkit-transform: scale(0.5);
    transform: scale(0.5);
    border-width: 1px;
  }
}

// 点击背景变黑 5%

.-background-active(@bg, @per: 5%) {
  background-color: @bg;
  &:active {
    background-color: darken(@bg, @per);
  }
}

//正方形

.-quadrate(@width) {
  width: @width;
  height: @width;
}

// 高铁+ 通用input 封装样式  appearance  placeholder  autofillColor 如下

.input_12306(@h: 28px, @font: 32px, @placeholder-size: 32px) {
  .-appearance();
  height: @h;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  margin: 0;
  .-autofillColor(#ffffff);
  font-size: @font;
  .-placeholder(@font-placeholder, @placeholder-size);
}

// 高铁+ 通用input 去除默认样式
.-appearance() {
  -webkit-appearance: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  text-transform: none;
  overflow: visible;
}

// 高铁+ 通用input  默认placeholder 样式

.-placeholder(@color : "#d0d5d0", @size: 32px, @lheight: normal) {
  &:-ms-input-placeholder {
    color: @color;
    line-height: @lheight;
    font-size: @size;
  }
  &::-moz-placeholder {
    color: @color;
    line-height: @lheight;
    font-size: @size;
  }
  &:-moz-placeholder {
    color: @color;
    line-height: @lheight;
    font-size: @size;
  }
  &::-webkit-input-placeholder {
    color: @color;
    line-height: @lheight;
    font-size: @size;
  }
}

// 高铁+ 通用input  填充背景和颜色样式

.-autofillColor(@bg: #FFF) {
  background-color: @bg;

  &:-webkit-autofill {
    box-shadow: 0 0 0px 1000px @bg inset;
  }
}
.-iconfont() {
  font-family: iconfont !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -webkit-text-stroke-width: 0.2px;
  -moz-osx-font-smoothing: grayscale;
  outline: none;
}
// 全部半像素边框
.-border-half(@position: bottom, @style: solid, @color: #f0f0f0, @radius: inherit)
  when(@position =all) {
  position: relative;
  &:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    border-width: 1px;
    border-style: @style;
    border-color: @color;
    border-radius: @radius;
    transform-origin: 0 0;
    transform: scale(0.5);
    z-index: 0;
  }
  * {
    z-index: 1;
  }
}
// 旋转360 动画
.-rotate360-keyframes(@name: rotate-360, @from: 0deg, @to: 360deg) {
  @keyframes @name {
    0% {
      -webkit-transform: rotate(@from);
      transform: rotate(@from);
    }
    100% {
      -webkit-transform: rotate(@to);
      transform: rotate(@to);
    }
  }
}

.-rotate360(@s: 1s, @name: rotate-360) {
  animation: @name @s infinite linear;
}
.-font-regular() {
  font-family: "PingFang-SC-Regular" !important;
}

// 按钮
.-btn(@color, @height, @bg-act : darken(@color, 15%), @size: @height * 0.4444, @font: #FFFFFF) {
  .-text-height(@height);
  display: inline-block;
  margin: 0;
  padding: 0 64px;
  font-size: @size;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  border-radius: 0;
  outline: 0;
  vertical-align: middle;
  .-appearance(

  ); //transition: background-color .1s ease-out, border-color .1s ease-out, box-shadow .1s ease;
  background-color: @color;
  color: @font;
  &:active {
    background-color: @bg-act; //box-shadow: 0 0 4px darken(@color, 18%);
  }
  &[circle] {
    border-radius: 200px;
  } // 灰度
  &[gray],
  &.gray {
    &,
    &:active {
      background-color: #ddd;
      color: #ffffff;
      border-color: transparent;
    }
  } // 禁止
  &[disabled],
  &.disabled {
    &,
    &:active {
      pointer-events: none;
      background-color: #ddd;
      color: #ffffff;
      border-color: transparent;
    }
  }
}
